package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin //准许所有域名访问     （域名）只允许括号里的域名访问
public class UserController {
    @Autowired
    private UserService userService;
//    @RequestMapping("/getAll") 所有的请求类型都支持
    @GetMapping("/getAll")//只允许查询请求类型

    public List<User> getAll(){
        return userService.getAll();
    }
}
